#ifndef TEMPLIB_H_
#define TEMPLIB_H_

#include "stdint.h"
#include "dataproc.h"
#include "correct.h"
#include "dict.h"

#ifdef __cplusplus
extern "C"
{
#endif

#define TERR_LIMITE_H_MASK 0x01
#define TERR_TABLE_H_MASK 0x02
#define TERR_LIMITE_L_MASK 0x10
#define TERR_TABLE_L_MASK 0x20

	typedef struct
	{
		uint8_t b_CF;	  
		uint8_t err;	  

		int16_t tc_air;						 
		float filter;						 
		const dict_f32_type *remap_tab;      
		i32_limit_type div;					 
		i32_limit_type mark;				 
		i32_limit_type limit;				 

		float coef;

		struct
		{
			float f_org; 
			float f_ctr;
			float f_real;
			float f_disp;
			int32_t i_ctr;
			int32_t i_disp;
			int32_t i_org;
		} result;

		struct
		{
			int32_t pb;
			int32_t pk;

			uint8_t point_len;
			const void *point_list;
			
			float offset_before, offset_after;
		} correct;

	} sen_remap_obj_type;

	float sen_remap_get(sen_remap_obj_type *remap_obj);
	int32_t sen_remap_int_get(sen_remap_obj_type *remap_obj);
	int32_t sen_remap_disp_get(sen_remap_obj_type *remap_obj);
	uint8_t sen_remap_err_get(sen_remap_obj_type *remap_obj);

	void sen_remap_cal_i16map(sen_remap_obj_type *remap_obj, int32_t ad_val);
	void sen_remap_cal_i32map(sen_remap_obj_type *remap_obj, int32_t ad_val);
	void sen_remap_cal_f32map(sen_remap_obj_type *remap_obj, int32_t ad_val);

	void sen_remap_cal_pbkp(sen_remap_obj_type *remap_obj, int32_t ad_val);

	void sen_remap_reset(sen_remap_obj_type *obj, int32_t result);

#ifdef __cplusplus
}
#endif

#endif 
